home *** CD-ROM | disk | FTP | other *** search
/ HaCKeRz Kr0nlcKLeZ 1 / HaCKeRz Kr0nlcKLeZ.iso / chibacity / gbbdisk.arj / PROTMODE / HWHNDLR.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-11-02  |  6.4 KB  |  153 lines

  1. ;*******************************************************************************
  2. ;*  This is the hardware interrupt handler for the protected mode V86 Monitor. *
  3. ;*  The standard IRQ's have been relocated to 20H-27H, and the second set used *
  4. ;*  by the AT are left in the same place. All this handler does is reflect all *
  5. ;*  interrupts back to V86 mode for processing by the standard BIOS handlers.  *
  6. ;*******************************************************************************
  7.  
  8. ;For use in V86.ASM, etc.
  9.  
  10. ;(C) 1993 American Eagle Publications, Inc., All rights reserved!
  11.  
  12.  
  13. ;This routine handles the timer hardware interrupt, normally INT 8 in a PC,
  14. ;but this is INT 20H here!
  15. TIMER_HANDLER:
  16.                 push    ebx
  17.                 mov     bl,8                    ;point to timer vector
  18.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  19.  
  20. ;This routine handles the keyboard hardware interrupt, normally INT 9 in a PC,
  21. ;but this is INT 21H here!
  22. KBD_HANDLER:
  23.                 push    ebx
  24.                 mov     bl,9                    ;point to keyboard vector
  25.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  26.  
  27. INT_A:
  28.                 push    ebx
  29.                 mov     bl,10                   ;point to timer vector
  30.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  31.  
  32. INT_B:
  33.                 push    ebx
  34.                 mov     bl,11                   ;point to timer vector
  35.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  36.  
  37. INT_C:
  38.                 push    ebx
  39.                 mov     bl,12                   ;point to timer vector
  40.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  41.  
  42. INT_D:
  43.                 push    ebx
  44.                 mov     bl,13                   ;point to timer vector
  45.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  46.  
  47. INT_E:
  48.                 push    ebx
  49.                 mov     bl,14                   ;point to timer vector
  50.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  51.  
  52. INT_F:
  53.                 push    ebx
  54.                 mov     bl,15                   ;point to timer vector
  55.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  56.  
  57. INT_70:
  58.                 push    ebx
  59.                 mov     bl,70H                  ;point to VM vectorr
  60.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  61.  
  62. INT_71:
  63.                 push    ebx
  64.                 mov     bl,71H                  ;point to VM vector
  65.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  66.  
  67. INT_72:
  68.                 push    ebx
  69.                 mov     bl,72H                  ;point to VM vectorr
  70.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  71.  
  72. INT_73:
  73.                 push    ebx
  74.                 mov     bl,73H                   ;point to VM vectorr
  75.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  76.  
  77. INT_74:
  78.                 push    ebx
  79.                 mov     bl,74H                  ;point to VM vectorr
  80.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  81.  
  82. INT_75:
  83.                 push    ebx
  84.                 mov     bl,75H                  ;point to VM vectorr
  85.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  86.  
  87. INT_76:
  88.                 push    ebx
  89.                 mov     bl,76H                  ;point to VM vectorr
  90.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  91.  
  92. INT_77:
  93.                 push    ebx
  94.                 mov     bl,77H                  ;point to VM vectorr
  95.                 jmp     SHORT HW_HANDLER        ;go do the usual hardware handling
  96.  
  97. HW_HANDLER:
  98.                 push    ebp
  99.                 mov     ebp,esp
  100.                 push    eax
  101.                 push    ecx
  102.  
  103.                 mov     ax,BIOS_SEL
  104.                 mov     ds,ax
  105.                 xor     eax,eax
  106.                 mov     al,bl
  107.                 shl     eax,2                   ;eax=@ of interrupt vector
  108.                 push    eax
  109.  
  110.                 cmp     eax,9*4                 ;was it the keyboard handler?
  111.                 jnz     SHORT HW_HNDLR2         ;nope, go on
  112.                 mov     ebx,417H                ;else check for Ctrl-Alt-Del
  113.                 mov     ebx,[ebx]               ;get keyboard status byte
  114.                 and     bl,00001100B
  115.                 xor     bl,00001100B            ;see if Ctrl and Alt are down
  116.                 jnz     SHORT HW_HNDLR2
  117.                 in      al,[60H]                ;get byte from kb controller
  118.                 cmp     al,83                   ;is it the DEL key?
  119.                 jnz     SHORT HW_HNDLR2         ;nope, go on
  120.                 mov     al,0F0H                 ;yes, activate reset line
  121.                 out     [64H],al
  122.                 jmp     $                       ;and wait here for it to go
  123.  
  124. HW_HNDLR2:
  125.                 xor     ebx,ebx
  126.                 mov     bx,[ebp+24]             ;get VM ss
  127.                 shl     ebx,4                   ;make absolute @ from it
  128.                 mov     ecx,[ebp+20]            ;get VM sp
  129.                 sub     ecx,6
  130.                 add     ebx,ecx                 ;absolute @ of stack in ebx
  131.                 mov     eax,[ebp+16]            ;get flags from VM caller
  132.                 mov     [ebx+4],ax              ;put flags on VM stack
  133.                 and     eax,0FFFFFDFFH          ;cli
  134.                 mov     [ebp+16],eax            ;save flags with cli for return
  135.                 mov     ax,[ebp+12]             ;get VM cs
  136.                 mov     [ebx+2],ax              ;save it on VM stack
  137.                 mov     eax,[ebp+8]             ;get VM ip
  138.                 mov     [ebx],ax                ;save it on VM stack
  139.                 mov     [ebp+20],ecx            ;and update it
  140.  
  141.                 pop     ebx
  142.                 mov     eax,[ebx]               ;get VM ISR @ for this interrupt
  143.                 mov     [ebp+8],ax              ;save VM int handler as return ip
  144.                 shr     eax,16
  145.                 mov     [ebp+12],ax             ;and return cs
  146.  
  147.                 pop     ecx
  148.                 pop     eax
  149.                 pop     ebp
  150.                 pop     ebx                     ;clean up and exit
  151.                 iretd
  152.  
  153.